package com.app.brilliant.game.service.impl;

import com.app.brilliant.common.service.impl.BaseServiceImpl;
import com.app.brilliant.game.bean.BriCourse;
import com.app.brilliant.game.response.BriClassHourWithType;
import com.app.brilliant.game.response.BriClassHourWithTypeInfo;
import com.app.brilliant.game.response.BriCourseWithCompletionInfo;
import com.app.brilliant.game.service.BriCourseService;
import com.app.brilliant.game.mapper.BriCourseMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import java.util.List;

/**
* @author GF
* @description 针对表【bri_course】的数据库操作Service实现
* @createDate 2025-09-01 20:45:51
*/
@Service
public class BriCourseServiceImpl extends BaseServiceImpl<BriCourseMapper, BriCourse>
implements BriCourseService{

    @Override
    public BriCourse selectOneByCourseName(String courseName) {
        QueryWrapper<BriCourse> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("course_name", courseName);
        return baseMapper.selectOne(queryWrapper);
    }

    @Override
    public List<BriCourse> listByCIdAndLocked(Long cId, Integer locked) {
        QueryWrapper<BriCourse> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("c_id", cId).eq("locked", locked);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public BriCourseWithCompletionInfo getCourseWithCompletionInfo(Long courseId, Integer uid) {
        return baseMapper.getCourseWithCompletionInfo(courseId, uid);
    }

}
